load("@prysm//tools/go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "arrays.go",
        "attestations.go",
        "blocks.go",
        "state_root.go",
        "trie_helpers.go",
        "validators.go",
    ],
    importpath = "github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil",
    visibility = [
        "//beacon-chain:__subpackages__",
        "//fuzz:__pkg__",
        "//proto/migration:__subpackages__",
        "//proto/testing:__subpackages__",
        "//shared/blockutil:__subpackages__",
        "//shared/testutil:__subpackages__",
        "//slasher:__subpackages__",
        "//tools/blocktree:__pkg__",
        "//tools/pcli:__pkg__",
        "//validator/client:__pkg__",
    ],
    deps = [
        "//proto/beacon/p2p/v1:go_default_library",
        "//shared/bytesutil:go_default_library",
        "//shared/featureconfig:go_default_library",
        "//shared/hashutil:go_default_library",
        "//shared/htrutils:go_default_library",
        "//shared/params:go_default_library",
        "//shared/trieutil:go_default_library",
        "@com_github_dgraph_io_ristretto//:go_default_library",
        "@com_github_pkg_errors//:go_default_library",
        "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
        "@com_github_prysmaticlabs_go_ssz//:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "attestations_test.go",
        "benchmark_test.go",
        "blocks_test.go",
        "state_root_test.go",
        "stateutil_test.go",
        "trie_helpers_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//proto/beacon/p2p/v1:go_default_library",
        "//shared/bytesutil:go_default_library",
        "//shared/featureconfig:go_default_library",
        "//shared/hashutil:go_default_library",
        "//shared/htrutils:go_default_library",
        "//shared/interop:go_default_library",
        "//shared/params:go_default_library",
        "//shared/testutil:go_default_library",
        "//shared/testutil/assert:go_default_library",
        "//shared/testutil/require:go_default_library",
        "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
    ],
)

go_test(
    name = "go_benchmark_test",
    size = "medium",
    srcs = ["benchmark_test.go"],
    args = [
        "-test.bench=.",
        "-test.benchmem",
        "-test.v",
    ],
    local = True,
    tags = [
        "benchmark",
        "manual",
        "no-cache",
    ],
    deps = [
        "//beacon-chain/state/stateutil:go_default_library",
        "//shared/hashutil:go_default_library",
        "//shared/htrutils:go_default_library",
        "//shared/testutil:go_default_library",
        "@com_github_protolambda_zssz//merkle:go_default_library",
        "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
        "@com_github_prysmaticlabs_go_ssz//:go_default_library",
    ],
)
